package JavaSEAdvance.day10_MapAndStream.D10_5HomeWork;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

/**
 * @author Xiao
 * @date 2021/7/28
 */
public class Test1 {
    /**
     * 需求：现在有两个ArrayList集合，分别存储6名男演员名称和6名女演员名称，要求完成如下的操作：
     * 男演员只要名字为3个字的前三人；
     * 女演员只要姓林的，并且不要第一个；
     * 把过滤后的男演员姓名和女演员姓名合并到一起；
     * 把上一步操作后的元素作为构造方法的参数创建演员对象,遍历数据。
     *
     * 男演员："周润发","成龙","刘德华","吴京","周星驰","李连杰"；
     * 女演员："林心如","张曼玉","林青霞","柳岩","林志玲","王祖贤"。
     */
    public static void main(String[] args) {
        ArrayList<String> listMan = new ArrayList<>(List.of(
                "周润发", "成龙", "刘德华", "吴京", "周星驰", "李连杰"));
        ArrayList<String> listWoman = new ArrayList<>(List.of(
                "林心如","张曼玉","林青霞","柳岩","林志玲","王祖贤"));
        Stream<String> stream1 = listMan.stream().filter(name -> name.length() == 3).limit(3);
        Stream<String> stream2 = listWoman.stream().filter(name -> name.startsWith("林")).skip(1);
        /*List<String> list = Stream.concat(stream1, stream2).collect(Collectors.toList());
        for (String name : list) {
            System.out.println(new Actor(name));
        }*/
        Stream.concat(stream1, stream2).forEach(name -> System.out.println(new Actor(name)));
    }
}
